Select Excel Range
IronXL for Python makes it easy to select and work with ranges in any Excel WorkSheet. The code below demonstrates how ranges, rows, and columns can be selected. After selection, aggregate methods such as SortAscending(), SortDescending(), Sum(), Max(), Min(), and Average() can be applied to the collected data. Note that when methods modify or move cell values, the affected range, row, or column will reflect those changes accordingly.
Range
To select a range from A2 to A8, use range_ = worksheet["A2:A8"].
Row
To select row 1, use worksheet.GetRow(0). Indexing is zero-based. The range of cells returned is determined by the union of all populated cells across all rows, including row 1 itself.
Column
To select column A, use worksheet.GetColumn(0) or assign the range address as worksheet["A:A"]. The range of cells is determined by the union of all populated cells across all columns, including column A itself.
How to Select an Excel Range in Python
- Install IronXL for Python to select Excel ranges.
- Load an existing workbook or create a new one.
- Select the target worksheet from the workbook.
- Use
worksheet["A2:A8"]to select a range fromA2toA8. - Use
GetColumnandGetRowmethods to select individual columns and rows.






